package com.caltco.cargo.ops.modules.sys.request;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.time.LocalDateTime;
import java.util.List;

@Data
public class TaskRequest {
    private static final long serialVersionUID = 1L;

    @TableId(type = IdType.ASSIGN_ID)
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    @Schema(description = "任务Id")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long id;


    @Schema(description = "用户id")
    @TableField("user_id")
    @JsonProperty("userId")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long userId;

    @Schema(description = "项目id")
    @TableField("project_id")
    @JsonProperty("projectId")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long projectId;

    @Schema(description = "项目名称")
    @TableField("task_name")
    @JsonProperty("taskName")
    private String taskName;

    @Schema(description = "等级")
    @TableField("level")
    @JsonProperty("level")
    private Integer level;

    @Schema(description = "任务结束时间")
    @TableField("task_end_time")
    @JsonProperty("taskEndTime")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime taskEndTime;


    @Schema(description = "任务开始时间")
    @TableField("task_start_time")
    @JsonProperty("taskStartTime")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime taskStartTime;


    @Schema(description = "任务进度")
    @TableField("process")
    @JsonProperty("process")
    private Double process;

    @Schema(description = "任务描述")
    @TableField("task_description")
    @JsonProperty("taskDescription")
    private String taskDescription;

    @Schema(description = "用户id")
    @TableField("user_ids")
    @JsonProperty("userIds")
    private List<Long> userIds;

    @Schema(description = "是否立即发布")
    @TableField("is_publish")
    @JsonProperty("isPublish")
    private Integer isPublish;

    @Schema(description = "项目负责人id")
    @TableField("handler_id")
    @JsonProperty("handlerId")
    private Long handlerId;

    @Schema(description = "根据等级排序")
    @TableField("order_asc")
    @JsonProperty("orderAsc")
    private Boolean orderAsc;

    @Schema(description = "是否是项目数据查询")
    @TableField("is_project")
    @JsonProperty("isProject")
    private Integer isProject;
}
